﻿using Manon.Admin.Web.ApplicationCore.Dtos.Other;
using Manon.Admin.Web.ApplicationCore.Interfaces;
using Manon.Autofac;
using Manon.Core.Commons;
using Manon.Repository.Collections;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Manon.Admin.Web.Controllers
{
    public class FriendlylinkController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }
        public IActionResult Edit()
        {
            return View();
        }


        [Authorize]
        [HttpPost]
        public async Task<IPagedList<GetFriendlylinkOutput>> GetFriendlylinkPagedList([FromBody] GetFriendlylinkPagedListInput Input)
        {

            var otherService = Resolver.Resolve<IOtherService>();
            var result = await otherService.GetFriendlylinkPagedList(Input);

            return result;
        }

        [Authorize]
        [HttpPost]
        public async Task<Result> SaveFriendlylink([FromBody] SaveFriendlylinkInput Input)
        {
            var otherService = Resolver.Resolve<IOtherService>();
            var result = await otherService.SaveFriendlylink(Input);
            return result;
        }
        [Authorize]
        [HttpGet]
        public async Task<GetFriendlylinkOutput> GetFriendlylink(int Id)
        {

            var otherService = Resolver.Resolve<IOtherService>();
            var result = await otherService.GetFriendlylink(Id);
            return result;
        }
        [Authorize]
        [HttpPost]
        public async Task<Result> SetFriendlylinkEnabled(int Id, bool Enabled)
        {

            var otherService = Resolver.Resolve<IOtherService>();
            var result = await otherService.SetFriendlylinkEnabled(Id, Enabled);
            return result;
        }
    }
}
